######## Replication of Figure 1

# Set the relevant working directory where the dataset "Graph Data.dta" is stored. 
setwd("...")

# Call the foreign library to read in Stata .dta files
library(foreign)

# Read in the de-labelled subset of the main data required to generate Figure 1
den <- read.dta("Graph Data.dta")

# Panel A of Figure 1
pdf("DCB_treatments_1.pdf")
plot(density(na.omit(subset(den$urate_fut, den$treatment==1)), bw=0.65), ylim=c(0,0.3), xlim=c(0,20), main="", xlab="2013 unemployment expectation (%)", ylab="Density", bty="l", lwd=2)
par(new=T)
plot(density(na.omit(subset(den$urate_fut, den$treatment==8)), bw=0.65), col="grey", ylim=c(0,0.3), xlim=c(0,20), xlab="", ylab="", main="", bty="l", lty=2)
par(new=T)
plot(density(na.omit(subset(den$urate_fut, den$treatment==2)), bw=0.65), col="black", ylim=c(0,0.3), xlim=c(0,20), xlab="", ylab="", main="", bty="l", lty=2)
par(new=T)
plot(density(na.omit(subset(den$urate_fut, den$treatment==3)), bw=0.65), col="grey", ylim=c(0,0.3), xlim=c(0,20), xlab="", ylab="", main="", bty="l", lty=5)
legend(x="topright", legend=c("Control", "DCB 7%", "Assume DCB 7%", "Assume DCB 5%"), text.col=c("black", "grey", "black", "grey"), lty=c(1, 2, 2, 5), lwd=c(2,1,1,1), box.lwd=0, box.col="white", bg="white")
dev.off()

# Panel B of Figure 1
pdf("DCB_treatments_2.pdf")
plot(density(na.omit(subset(den$urate_fut, den$treatment==1)), bw=0.65), ylim=c(0,0.3), xlim=c(0,20), main="", xlab="2013 unemployment expectation (%)", ylab="Density", bty="l", lwd=2)
par(new=T)
plot(density(na.omit(subset(den$urate_fut, den$treatment==4)), bw=0.65), ylim=c(0,0.3), xlim=c(0,20), xlab="", ylab="", main="", bty="l", lty=2)
par(new=T)
plot(density(na.omit(subset(den$urate_fut, den$treatment==5)), bw=0.65), ylim=c(0,0.3), xlim=c(0,20), xlab="", ylab="", main="", bty="l", lty=5)
par(new=T)
plot(density(na.omit(subset(den$urate_fut, den$treatment==6)), bw=0.65), col="grey", ylim=c(0,0.3), xlim=c(0,20), xlab="", ylab="", main="", bty="l", lty=2)
par(new=T)
plot(density(na.omit(subset(den$urate_fut, den$treatment==7)), bw=0.65), col="grey", ylim=c(0,0.3), xlim=c(0,20), xlab="", ylab="", main="", bty="l", lty=5)
legend(x="topright", legend=c("Control", "Assume govt. 7%", "Assume govt. 5%", "Assume opp. 7%", "Assume opp. 5%"), text.col=c("black", "black", "black", "grey", "grey"), lty=c(1, 2, 5, 2, 5), lwd=c(2,1,1,1,1), box.lwd=0, box.col="white", bg="white")
dev.off()
